let path = require('path')


function resolve (dir) {
  return path.join(__dirname, dir)
}

module.exports = {

  chainWebpack: config => {
    // 生产环境下关闭css压缩的 colormin 项，因为此项优化与主题色替换功能冲突
    if (process.env.NODE_ENV === 'production') {
      config.plugin('optimize-css')
        .tap(args => {
            args[0].cssnanoOptions.preset[1].colormin = false
          return args
        })
    }
    config.resolve.alias
        .set('@', resolve('src'))
        .set('@controller', resolve('/src/actions/controller.js'))
        .set('@util', resolve('/src/libs'))
  },
  outputDir: 'dist',
  assetsDir: 'static',
  productionSourceMap: false
}
